
using UnityEngine;


public class PlayerWallJump : PlayerStateBase
{
    public PlayerWallJump(ControllerBase controller, StateMachineBase stateMachine, string stateName,string 
        animatorParameter) 
        : base(controller, stateMachine, stateName,animatorParameter)
    {
    }

    public override void Enter()
    {
        base.Enter();
        controller.SetVelocity(new Vector2(5*-controller.faceDir,Setting.jumpForce));
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();
        if (controller.isGround)
        {
            stateMachine.ChangeState(Setting.ground);
            return;
        }

        if (controller.GetVelocity().y < 0)
        {
            stateMachine.ChangeState(Setting.air);
            return;
        }
    }
}
